<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="crm.util.ParamUtil" %>
<%@ page import="crm.model.Product_model"%>
<%@ page import="crm.model.Product_system"%>
<%@ page import="crm.model.Product_service"%>
<%@ page import="crm.util.Pagination"%>
<%@ page import="crm.control.ProductControl"%>
<%@ page import="crm.model.Product_system_stage" %>
<%@page import="java.util.Collection"%>
<%@page import="java.util.Iterator"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>product_model</title>
</head>
<body>
        <%
            request.setCharacterEncoding("UTF-8");
            String model_number="";
            String model_name="";
            String create_time="";
            
            
            int type=ParamUtil.getInt(request,"type",1);
            if(type==1){
            model_number=ParamUtil.getString(request,"model_number",null);
            model_name=ParamUtil.getString(request,"model_name",null);
            create_time=ParamUtil.getString(request,"create_time",null);
            
            session.setAttribute("model_number",model_number);
            session.setAttribute("model_name",model_name);
            session.setAttribute("create_time",create_time);
            }else{
            model_number=(String)session.getAttribute("model_number");
            model_name=(String)session.getAttribute("model_name");
            create_time=(String)session.getAttribute("create_time");
            }
        
         %>
         
         <form action="product_model.jsp?type=1" method="post">
         <fieldset>
         <legend>搜索条件</legend>
         <table>
         <tr>
         <td>模块名称：<input type="text" name="model_name" value="<%if(model_name!=null&&!model_name.equals("")) out.print(model_name);%>"/></td>
         <td>模块编号：<input type="text" name="model_number" value="<%if(model_number!=null&&!model_number.equals("")) out.print(model_number); %>"/></td>
         <td>创建时间: <input type="text" name="create_time" value="<%if(create_time!=null&&!create_time.equals("")) out.print(create_time); %>"></td>
         <td><input type="submit" value="查询"/></td>
         </tr>
         </table>
         </fieldset>       
         </form>
         
         
         <form></form>
         <form method="post">
         <fieldset>
         <legend>显示结果 </legend>
            <table>
                  <thead>
  <tr>
  <th>模块编号</th>
  <th>模块名称</th>
  <th>所属系统</th>
  <th>价格</th>
  <th>创建时间</th>
  <th>开发部门</th>
  <th>开发人</th>
  <th>描述</th>
  <th>操作</th>
  <th>操作</th>
  </tr>
  </thead>
            <tbody>
            <%
                 request.setCharacterEncoding("UTF-8");
                 int modelPages=ParamUtil.getInt(request,"pages",0);
                 int modelRowsPages=ParamUtil.getInt(request,"pageSize",10);
                 Collection model=ProductControl.searchModel(model_number,model_name,create_time,modelRowsPages,modelPages);
                 Iterator iterator=model.iterator();
                 while(iterator.hasNext()){
                    Product_model productModel=(Product_model)iterator.next();
   %>                 
   <tr>
   <td align="center"><%=productModel.getModel_number() %></td>
   <td align="center"><%=productModel.getModel_name() %></td>
   <%Product_system productSystem= ProductControl.getProductSystemById(productModel.getSystem_product_id()); %>
   <td align="center"><%=productSystem.getSystem_name() %></td>
   <td align="center"><%=productModel.getPrice() %></td>
   <td align="center"><%=productModel.getCreate_time() %></td>
   <td align="center"><%=productModel.getDevelope_depart() %></td>
   <td align="center"><%=productModel.getDeveloper() %></td>
   <td align="center"><%=productModel.getDescription() %></td>
   <td align="center"><a href="product_model_update.jsp?id=<%=productModel.getId() %>">修改</a></td>
   <td align="center"><a href="product_model_delete.jsp?id=<%=productModel.getId() %>" onclick='return confirm("确定要删除吗？")'>删除</a></td>
   </tr>
    <% } %>
            </tbody>
            </table>
         </fieldset>
         <%
		out.println(ProductControl.pageInstance2.getToolsMenu(modelPages));
			%>
  <input type="button" value="添加模块" onclick="window.location.href='product_model_add.jsp'">
         </form>
</body>
</html>